package Books.Example;

/* public String replaceAll(String regex, String replacement);
 * 	当前字符串调用replaceAll()方法返回一个字符串,但不改变当前字符串
 * */

public class Example8_10 {
	public static void main(String[] args) {
		String str = new String("欢迎大家访问http://www.xiaojian.cn了解、参观公司");
		// String regex = "(http://|www)\56?\\w+\56{1}\\w+\56{1}\\p{Alpha}+";
		String regex = "http://\\w*\\p{Punct}*\\w*\\p{Punct}*\\w*";
		
		System.out.printf("替换\n\"%s\"\n中的网站链接信息后得到的字符串:\n", str);
		str = str.replaceAll(regex, "*****");
		System.out.println(str);
		
		String money = "89,235,678￥";
		System.out.print(money + " 转化成数字:");
		String s = money.replaceAll("[,\\p{Sc}]", ""); // "\\p{Sc}"可匹配任何货币符号
		long number = Long.parseLong(s);
		System.out.println(number);
	}
}
